#ifndef WGLRENDERSYSTEM_H
#define WGLRENDERSYSTEM_H
#include "StompedReality/Core.h"
#include "StompedReality/Core/Graphics/RenderSystem.h" // Base class: stomped_reality::render_system::RenderSystem
#include <gl\gl.h>
#include <gl\glu.h>
#include <windows.h>
namespace StompedReality
{
namespace Graphics
{
/*!
 *
 * \author	Stefan Kazalski
 *
 * \brief	Windows render system using wgl.
 *
 *    Creates the render context and renders.
 */
class DLL_EXPORT WGLRenderSystem : public StompedReality::Graphics::RenderSystem
{
 protected:

  static bool m_Close;
  HGLRC m_HRC;
  HDC m_HDC;
  HWND m_HWND;
  HINSTANCE m_HInstance;

 protected:

  static LRESULT CALLBACK WndProc ( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam );

 public:

  //! \brief	Constructor.
  WGLRenderSystem( );

  //! \brief	Destructor.
  virtual ~WGLRenderSystem( );
  HDC GetHDC( );

  /*!
   * \brief		Creates a new windows.
   *
   * \param		width	The width of the render context.
   * \param		height	The height of the render context
   * \param		fullscreen	Is fullscreen.
   * \param		title	The windows title.
   *
   * \return	True if success otherwise false.
   */
  bool InitWindow ( int width, int height, bool fullscreen, const char* title );

  /*!
   * \brief		Closes the window.
   *
   * \return	True if success otherwise false.
   */
  bool CloseWindow( );

  /*!
   * \brief		Initializes the OpneGL extensions.
   *
   * \return	True if success otherwise false
   */
  bool InitGLExtensions( );

  /*!
   * \brief		Tests if the window is open.
   *
   * \return	True if open otherwise false.
   */
  bool IsWindowOpen( );

  void SwapBuffer ( );
  void* GetDisplayPointer( );

};

}
}
#endif // WGLRENDERSYSTEM_H